from src.event.notice_event import Notify_poke_event, Private_recall_event
from src.event.notice_event.Group import Recall_event, Ban_event, Increase_event


async def run(notice_data: dict, notice_type: str):
    """
    通知事件
    :param notice_data: 通知数据
    :param notice_type: 通知类型
    :return:
    """
    sub_type = notice_data.get("sub_type", "")
    if notice_type == "private_recall" or notice_type == "friend_recall":  # 私聊消息撤回
        await Private_recall_event.run(notice_data)
        return
    if notice_type == "group_recall":  # 群聊消息撤回
        await Recall_event.run(notice_data)
        return
    if notice_type == "group_increase":  # 群组成员增加
        await Increase_event.run(notice_data)
        return
    if notice_type == "group_decrease":  # 群组成员减少
        return
    if notice_type == "group_admin":  # 群组管理员变动
        return
    if notice_type == "group_upload":  # 群文件上传
        return
    if notice_type == "private_upload":  # 私聊文件上传
        return
    if notice_type == "group_ban":  # 群禁言
        Ban_event.run(notice_data, notice_data["group_id"], notice_data["operator_id"], notice_data["duration"],
                      notice_data["user_id"])
        return
    if notice_type == "notify" and sub_type == "poke":  # 头像戳一戳
        Notify_poke_event.run(notice_data)
        return
    print("=" * 20)
    print(f"出现意外的通知事件类型={notice_type}")
    print(notice_data)
    print("=" * 20)
